import { defineStore } from "pinia";
import { optfastConsoleKey } from "../key";
import { OptfastConsoleApiModel } from "@/type/console/optfastConsole"; 

interface IBasicState {
  optfastConsoleState: OptfastConsoleApiModel

}

export const useOptfastStore = defineStore(optfastConsoleKey, {
  state(): IBasicState {
    return {
      optfastConsoleState: {
        effectMode: {
          enableEffectModel: false
        },
        optMemory: {
          enableDisCard: false,
          enableReduceMemory: false
        },
        optCache: {
          enableReduceCache: false
        },
        prepareBefore: {
          enablePrepareBefore: false
        },
        pageSpeed: {
          enableSubReSource: false
        }
      }
    }
  }

  ,
  actions: {
    updateLabConsole(optfastConsole: OptfastConsoleApiModel) {
      this.optfastConsoleState = optfastConsole;
    }
  },
  getters: {

    getLabConsole(state) { return state.optfastConsoleState }

  },
  persist: {

    pick: ["optfastConsoleState"]
  },
});